import { Application } from 'egg';

export default (app: Application) => {
    const { STRING, DATE, CHAR } = app.Sequelize;
    const model = app.model.define('admin', {
        admin_id: { type: STRING(32), primaryKey: true },
        admin_username: STRING(32),
        admin_password: STRING(32),
        admin_token: STRING(32),
        admin_identity: CHAR(1),//管理员身份（1：超级管理员，2：普通管理员）
        admin_status: CHAR(1),//状态（1：启用，2：停用）
        created_by: STRING(32),
        created_at: DATE(0),
        updated_by: STRING(32),
        updated_at: DATE(0),
        is_delete: CHAR(1),
    }, { tableName: 't_admin' });
    return model;
};

export class Admin {
    admin_id: string;
    admin_username: string;
    admin_password: string;
    admin_token: string;
    admin_identity: string;
    admin_status: string;
    created_by: string;
    created_at: string;
    updated_by: string;
    updated_at: string;
    is_delete: string;
}
